package com.qwz.example;

import com.qwz.example.abssegment.*;
import com.qwz.example.realize.MessageImplementor;
import com.qwz.example.realize.MessageMobile;
import com.qwz.example.realize.MessageSMS;
/**  
* @Description: 桥接模式测试客户端
* @Package com.qwz.example.Client
* @author Qiuwuzhi
* @date 2019/12/20 14:34
* @version V1.0
*/
public class Client {
    public static void main(String[] args){
        //创建具体的实现消息
        MessageImplementor implementor = new MessageSMS();
//        AbstractMessageFactory abstractMessageFactory = new AbstractMessageFactory(1);
        //创建一个普通消息对象
        AbstractMessage message = new CommonMessage(implementor);
        message.sendMessage("请你喝茶","小李");
        //创建一个加急消息对象
        message = new UrgencyMessage(implementor);
        message.sendMessage("请你喝茶","小李");
        //创建一个特急消息对象
        message = new SpecialUrgencyMessage(implementor);
        message.sendMessage("请你喝茶","小李");

        //把实现方式切换为手机短消息
        implementor = new MessageMobile();
        //创建一个普通消息对象
        message = new CommonMessage(implementor);
        message.sendMessage("请你喝茶","小李");
        //创建一个加急消息对象
        message = new UrgencyMessage(implementor);
        message.sendMessage("请你喝茶","小李");
        //创建一个特急消息对象
        message = new SpecialUrgencyMessage(implementor);
        message.sendMessage("请你喝茶","小李");
    }
}
